﻿namespace Ecobee.Net
{
	public enum AuthorizationScope
	{
		None,
		SmartRead,
		SmartWrite
	}

	public static class AuthorizationScopeExtensions
	{
		public static string ToApiString(this AuthorizationScope value)
		{
			string scope = string.Empty;

			if (value == AuthorizationScope.SmartWrite)
			{
				scope = "smartWrite";
			}
			else
			{
				scope = "smartRead";
			}

			return scope;
		}

		public static AuthorizationScope FromApiString(this string value)
		{
			AuthorizationScope returnValue = AuthorizationScope.None;

			if (value == "smartWrite")
			{
				returnValue = AuthorizationScope.SmartWrite;
			}
			else if (value == "smartRead")
			{
				returnValue = AuthorizationScope.SmartRead;
			}
			else
			{
				returnValue = AuthorizationScope.None;
			}

			return returnValue;
		}
	}
}
